﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Reflection;
using System.ComponentModel;
using Mesuro.Graphing.Utilities;

namespace Mesuro.Graphing.PropertiesControls {
	/// <summary>
	/// Interaction logic for GraphPropertiesDialog.xaml
	/// </summary>
	public partial class GraphPropertiesDialog : Window {

		#region DP: Graph
		public static readonly DependencyProperty GraphProperty = DependencyProperty.RegisterAttached( "Graph", typeof( Graph ), typeof( GraphPropertiesDialog ), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None, GraphChangedStatic ) );
		public Graph Graph {
			get { return (Graph)GetValue( GraphProperty ); }
			set { SetValue( GraphProperty, value ); }
		}
		public static Graph GetGraph( DependencyObject element ) { return (Graph)element.GetValue( GraphProperty ); }
		public static void SetGraph( DependencyObject element, Graph value ) { element.SetValue( GraphProperty, value ); }
		private static void GraphChangedStatic( DependencyObject sender, DependencyPropertyChangedEventArgs e ) {
			GraphPropertiesDialog gpd = sender as GraphPropertiesDialog;
			if (gpd != null)
				gpd.OnGraphChanged( (Graph)e.OldValue, (Graph)e.NewValue );
		}
		#endregion

		#region DP: AxesProperties
		public static readonly DependencyProperty AxesPropertiesProperty = DependencyProperty.RegisterAttached( "AxesProperties", typeof( UIElement ), typeof( GraphPropertiesDialog ), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None, AxesPropertiesChangedStatic ) );
		public UIElement AxesProperties {
			get { return (UIElement)GetValue( AxesPropertiesProperty ); }
			set { SetValue( AxesPropertiesProperty, value ); }
		}
		public static UIElement GetAxesProperties( DependencyObject element ) { return (UIElement)element.GetValue( AxesPropertiesProperty ); }
		public static void SetAxesProperties( DependencyObject element, UIElement value ) { element.SetValue( AxesPropertiesProperty, value ); }
		private static void AxesPropertiesChangedStatic( DependencyObject sender, DependencyPropertyChangedEventArgs e ) { }
		#endregion

		static GraphPropertiesDialog() {
			WindowStyleProperty.OverrideMetadata( typeof( GraphPropertiesDialog ), new FrameworkPropertyMetadata( WindowStyle.ToolWindow ) );
			ShowInTaskbarProperty.OverrideMetadata( typeof( GraphPropertiesDialog ), new FrameworkPropertyMetadata( false ) );
		}
		public GraphPropertiesDialog( Graph graph ) {
			Graph = graph;
			InitializeComponent();
			cboAxesTypes.ItemsSource = GraphingRegistry.GetAxesNames();
		}

		private void OnGraphChanged( Graph oldValue, Graph newValue ) {
		}

		private void GraphAxesChanged( object sender, RoutedPropertyChangedEventArgs<string> e ) {
		}


		private void cmdOK_Click( object sender, RoutedEventArgs e ) {
			//DialogResult = true;
			Close();
		}

		private void cmdSeriesDelete_Click( object sender, RoutedEventArgs e ) {
		}

	}
}
